package com.dyh.quickdemozwei.pipe0825;

import java.util.List;

//本身可以视为一个节点
public interface PipeLineItf  {
    List<PipeLineNodeItf> getNodes();
    void setNodes(List<PipeLineNodeItf> nodes);
    int size();

    default void work(PipeLineContext context){
        for (PipeLineNodeItf node : getNodes()) {
            Object res = node.work(context);
            if (context.end)
                break;
            context.setResult(res);
//            context.setVal(String.format(RESULT_KEY,node.getIndex()),res);

            context.indexInc();
        }

    }
}
